
import { _decorator, Component, Node, Vec2 } from 'cc';
import { Player } from '../components/player';
const { ccclass, property } = _decorator;

@ccclass('MainScene')
export class MainScene extends Component {

    @property(Player)
    player: Player = null!;

    @property(Node)
    joystick: Node = null!

    start() {
        this.joystick.on("move", this.onMovePlayer, this);
    }

    private onMovePlayer(direction: Vec2) {
        this.player.move(direction);
    }
}

